import { getGlobalData } from './globaldata'

const IMG_URL = getGlobalData('IMG_URL')

/* C端头像6选1 */
export const avater = (gender = 'male', userId = 0) =>
  [
    [
      'https://imagesize.hrwork.com/sp/files/4d2fefb7-d83a-4a68-81a0-9512b22140f7.png',
      'https://imagesize.hrwork.com/sp/files/8eff8873-bfbb-4797-92eb-948ecd236911.png',
      'https://imagesize.hrwork.com/sp/files/c841358a-140e-4b31-8069-fb16698fb475.png'
    ],
    [
      'https://imagesize.hrwork.com/sp/files/5a774e7a-226d-406c-9a5b-da24d30ee829.png',
      'https://imagesize.hrwork.com/sp/files/c9b3c044-2f36-496e-9f52-d4923df4193f.png',
      'https://imagesize.hrwork.com/sp/files/f2c0f79f-ceb5-43d6-8d6a-7f1a42222cd2.png'
    ]
  ][gender === 'female' ? 0 : 1][parseInt(userId) % 3 || 0]
/* B端头像2选1 */
export const avaterB = (gender = 'male') =>
  [
    ['https://imagesize.hrwork.com/sp/files/e309bd83-7ea5-4b01-97e4-4e67e7c17561.png'],
    ['https://imagesize.hrwork.com/sp/files/07871efa-4a77-48d3-9192-7ad0ea47ff3e.png']
  ][gender === 'female' ? 0 : 1][0]

/* 选择性别 */
export const chooseGender = (gender = 'male', chosed) =>
  [
    [
      'https://imagesize.hrwork.com/sp/files/6e2dd755-94a9-4263-98e7-01e4073fce82.png',
      'https://imagesize.hrwork.com/sp/files/9e5cd9d6-9fbf-493c-ab15-0ee3a5ba27b3.png'
    ],
    [
      'https://imagesize.hrwork.com/sp/files/e2cfbe75-0604-4d59-b5c6-daac1af5b276.png',
      'https://imagesize.hrwork.com/sp/files/92a20ff2-65e6-4756-b8ad-fc2b748a5e5c.png'
    ]
  ][gender === 'female' ? 0 : 1][chosed ? 0 : 1]

/* 老头像 */
export const avaterOld =
  'https://imagesize.hrwork.com/sp/files/aba62394-93b2-4db4-a2b7-dbf19e160f64.png'

// 相机头像
export const avaterCamerar =
  'https://imagesize.hrwork.com/sp/files/5a96fa37-4f93-40f6-9a1a-32071cc0acff.png'

// 筛选-勾
export const screenCheckMark =
  'https://imagesize.hrwork.com/sp/files/7912cce5-dadc-40e2-947a-c6aa53566886.png'

// 筛选-选中黄三角
export const screenCheckedYellow =
  'https://imagesize.hrwork.com/sp/files/ec4dc966-0bea-4643-add6-c6a1fdca11f3.png'

// 筛选-未选中-灰
export const screenCheckGray =
  'https://imagesize.hrwork.com/sp/files/cea506c0-750e-4f33-a379-cf734763ee11.png'

// 筛选-未选中-黑
export const screenCheckBlack =
  'https://imagesize.hrwork.com/sp/files/9814cde5-5729-4158-ac2d-cdf148be68f4.png'

// 获取用户性别icon
export const getGenderIcon = (gender = 'male') => {
  return gender == 'male'
    ? 'https://imagesize.hrwork.com/sp/files/96a9e07d-018f-4675-8754-b2feef70a741.png'
    : 'https://imagesize.hrwork.com/sp/files/8a214c2e-342f-4028-bcc4-c1ae6d6eff58.png'
}

// 对勾 头像和手机验证码页面的
export const checkPhoneMark =
  'https://imagesize.hrwork.com/sp/files/4efb9a95-04f0-49d1-8121-59dda800fef7.png'

// 更换手机号码的背景图
export const phoneBg =
  'https://imagesize.hrwork.com/sp/files/b00a59e3-8494-45e0-8dcb-0f2589c499b2.png'

// logo
export const miniLogo =
  'https://imagesize.hrwork.com/sp/files/13884f3e-1138-412b-ad8e-2746c5cfd65f.png'

// 处理头像路径
export const dealImgUrl = url => {
  if (url) {
    const re = /(http|https):\/\//
    const urlformat = re.test(url) ? url : IMG_URL + url
    return urlformat
  } else {
    return ''
  }
}
